<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <meta charset="utf-8"/>
    <title>网上订餐</title>
    <link th:href="@{/project/css/public.css}" rel="stylesheet"/>
    <link th:href="@{/project/css/myorder.css}" rel="stylesheet"/>
</head>
<body>
<!------------------------------head------------------------------>
<div class="head ding" th:include="include::normal_headDiv2"></div>
<!------------------------------idea------------------------------>
<div class="address mt">
    <div class="wrapper clearfix">
        <a th:href="@{/index}" class="fl">首页</a>
        <span>/</span>
        <a class="on">我的评价</a>
    </div>
</div>
<div class="Bott">
    <div class="wrapper clearfix">
        <div class="zuo fl" th:include="include::normal_left_menu"></div>
        <div class="you fl">
            <div class="my clearfix">
                <h2 class="fl">我的评价</h2>
            </div>
            <div class="dkuang" id="dataContainer" style="border: none;"></div>
        </div>
    </div>
</div>
<div th:include="include::normal_footerDiv"></div>
<div th:include="include::footer_normal"></div>
<script th:src="@{/project/cart.js}"></script>
<script th:inline="javascript">
    
    var _$dataModel = $('<div class="remark_container"><div class="word fl clearfix" style="width: 100%;">' +
        '                    <ul class="fl clearfix">' +
        '                        <li></li>' +
        '                        <li></li>' +
        '                    </ul>' +
        '                </div>' +
        '                <table style="width: 100%"></table></div>');
    var _$remarkItem = $('<tr>' +
        '                        <th width="37%" class="items">' +
        '                            <div class="shohou clearfix" >' +
        '                                <a class="fl"><img></a>' +
        '                                <span class="leave_out2 fl"></span>' +
        '                            </div>' +
        '                        </th>' +
        '                        <th width="15%">' +
        '                            <div class="star_div"></div>' +
        '                        </th>' +
        '                        <th width="40%">' +
        '                            <p class="remark_area" ></p>' +
        '                        </th>' +
        '                        <th width="8%">' +
        '                            <a href="javascript:void(0)">删除评价</a>' +
        '                        </th>' +
        '                    </tr>');
    
    $("#dataContainer").paginationInit({
        url:ctx+"user/remark/list",
        pageSize:20,
        loadDataItem:function (obj) {
            _$dataModel.find("ul li:eq(0)").html("订单编号："+obj.orderId);
            _$dataModel.find("ul li:eq(1)").html("评价时间："+obj.createTime);
            _$dataModel.find("table").empty();

            for(var j=0;j<obj.remarks.length;j++){
                _$remarkItem.find("img").attr("src",obj.remarks[j].imgUrl);
                _$remarkItem.find("img").parent().attr("href",goodsClickHref(obj.remarks[j].goodsId));
                _$remarkItem.find(".shohou span").html(obj.remarks[j].goodsName);
                _$remarkItem.find(".star_div").attr("data-score",obj.remarks[j].star);
                _$remarkItem.find(".remark_area").html(obj.remarks[j].msg).attr("title",obj.remarks[j].msg);
                _$remarkItem.find("th:eq(3) a").attr("onclick","delRemark("+obj.remarks[j].id+")");
                _$dataModel.find("table").append(_$remarkItem[0].outerHTML);
            }
            return _$dataModel[0].outerHTML;
        },
        onloadFinish:function () {
            $(".star_div").raty({
                score: function () {
                    return $(this).data('score');
                },
                readOnly:true
            });
        }
    });

    function delRemark(id) {
        if(confirm("确认删除吗？")){
            location.href=ctx+"user/remark/remove?id="+id;
        }
    }
</script>
</body>
</html>